package com.company;

public class Test20分数数列 {
    public static void main(String[] args) {
        System.out.println(sum());
    }

    /**
     * 分数数列计算和
     * @return
     */
    public static float sum(){
        int sum=0;
        int f =1;
        int z =2;
        int tmp=0;
        for(int i=0;i<20;i++){
            sum=sum+z/f;
            System.out.println(z+"/"+f);
            tmp=z;
            z=f+z;
            f=tmp;
        }
        return sum;
    }
}
